package per.turtle.system.feign.factory;

import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import per.turtle.system.feign.RemoteUserService;
import per.turtle.system.feign.fallback.RemoteUserFallbackImpl;

/**
 * 用户服务降级处理
 *
 * @author turtle
 */
@Component
public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService> {

    @Override
    public RemoteUserService create(Throwable throwable) {
        RemoteUserFallbackImpl fallback = new RemoteUserFallbackImpl();
        fallback.setCause(throwable);
        return fallback;
    }

}
